package org.dtrd.modules.doctor.entity.bean;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.config.system.Constant;
import org.dtrd.modules.doctor.entity.po.DtrdEntRdUserBank;

/**
 * <p>
 * 
 * </p>
 *
 * @author QR
 * @since 2021-12-14
 */
@Getter
@Setter
@ApiModel(value = "详情")
public class UserBankDetail {

    private Integer dataId;

    @ApiModelProperty("用户类型，2-医生")
    private Integer userBankUserType;

    @ApiModelProperty(value = "用户id, 即 doctorId 等", required = true)
    private Integer userBankUserId;

    @ApiModelProperty(value = "银行卡所属行id", required = true)
    private Integer userBankBankId;
    @ApiModelProperty("银行名称")
    private String bankName;

    @ApiModelProperty(value = "银行卡卡号", required = true)
    private String userBankBankCard;

    @ApiModelProperty(value = "持卡人姓名", required = true)
    private String userBankUserName;

    @ApiModelProperty("银行卡类型")
    private Integer userBankCardType;

    @ApiModelProperty("银行账户类型")
    private Integer userBankAccountType;

    @ApiModelProperty("提现密码")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String withDrawPwd;



    public UserBankDetail parseFromPo(DtrdEntRdUserBank po) {
        dataId = po.getDataId();
        userBankUserType = po.getUserBankUserType();
        Integer bankId = po.getUserBankBankId();
        if (bankId != null) {
            userBankBankId = bankId;
            bankName = Constant.BankInfo.valueOf(bankId).getName();
        }
        userBankUserId = po.getUserBankUserId();
        userBankBankCard = po.getUserBankBankCard();
        userBankUserName = po.getUserBankUserName();
        userBankCardType = po.getUserBankCardType();
        userBankAccountType = po.getUserBankAccountType();
        return this;
    }
}
